 <!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    

    <title>{$Think.config.site.title} - 需求管理</title>

    <meta name="keywords" content="{$Think.config.site.keywords}">

    <link href="{$Think.config.site.resource_url}css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/animate.min.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/style.min.css?v=4.0.0" rel="stylesheet">

</head>
<style>
#listtable .fa{
	cursor:pointer;
	color:#1ab394;
	margin-right:1em;
}
</style>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
     
      <div class="row">
          <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>需求列表</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="table-responsive">
                            <table class="table table-striped" id="listtable">
                                <thead>
                                    <tr>

                                        <th></th>
                                        <th>商品名称</th>
                                        <th>商品分类</th>
                                        <th>商品品牌</th>
                                        <th>商品规格</th>
                                        <th>供应商</th>
                                        <th>参考价格</th>
                                        <th>备注</th>
                                        <th>联系方式</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                	{volist name="list" id="vo"}
                                    <tr data-id="{$vo.demand_id}" >
                                        <td></td>
                                        <td>{$vo.good_name}</td>
                                        <td>{$vo.good_cate}</td>
                                        <td>{$vo.good_brand}</td>
                                        <td>{$vo.good_spec}</td>
                                        <td>{$vo.agent}</td>
                                        <td>{$vo.price}</td>
                                        <td>{$vo.remark}</td>
                                        <td>{$vo.contact}</td>
                                        <td><i class="fa fa-trash-o"> 删除</i>
                                        </td>
                                    </tr>
                                   {/volist}
                                </tbody>
                            </table>
                        </div>
                        <div>{$list->render()}</div>
                    </div>
                </div>
            </div>

        </div>
    </div>

    <script src="{$Think.config.site.resource_url}js/jquery.min.js?v=2.1.4"></script>
    <script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.5"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/peity/jquery.peity.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/iCheck/icheck.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/layer/layer.js"></script>
</body>

</html>
<script>
var layer_font;
$(document).ready(function() {
	//删除按钮
	$("#listtable").on("click",".fa-trash-o",function(){
		if(confirm("确定删除该数据吗？")){ 
			var $tr = $(this).closest("tr");
			var id = $tr.data("id");
			
			//确定删除
			$.ajax({
				type : 'POST',
				url : '<?php echo \think\Request::instance()->root(); ?>/admin/Goodsdemand/delete',
				dataType : 'json',
				data : {id:id},
				async:false,
				success : function(result) {
					//layer.close(layer1);
					if(1 === result.code) {
						$tr.remove();
						layer.msg(result.msg, {icon: 1});
					}  else  {
						//删除失败
						layer.msg(result.msg, {icon: 5});
					}
				},
				error : function(){
					res = false;
					layer.msg('服务器错误！请稍后重试', {icon: 2});
				}
			})
		}
	});
});	
</script>